package com.zhu.service.impl;

import com.zhu.DAO.UserDao;
import com.zhu.bean.User;
import com.zhu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public int addUser(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public User findByName(String nickName) {
        return userDao.selectByNickName(nickName);
    }

    @Override
    public boolean loginUser(User user) {
        User user1 = userDao.selectLogin(user);
        if (user1 != null){
            return true;
        }
        return false;
    }
}
